package nieflash.display {
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	
	public class animationButton extends MovieClip {
		public var clickAction:Function = null;
		
		public function animationButton():void {
			this.buttonMode = true;
			
			this.addEventListener(MouseEvent.MOUSE_OVER, mouseOver);
			this.addEventListener(MouseEvent.MOUSE_OUT, mouseOut);
			this.addEventListener(MouseEvent.CLICK, mouseClick);
		}
		
		private function mouseOver(evt:MouseEvent):void {
			if (currentLabel != "over") gotoAndPlay("over");
		}
		
		private function mouseOut(evt:MouseEvent):void {
			if (currentLabel != "out") gotoAndPlay("out");
		}
		
		private function mouseClick(evt:MouseEvent):void {
			if (clickAction != null) {
				clickAction();
			}
		}
	}
}